﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BDSim
{
    /// <summary>
    /// InitSimInfoWnd.xaml 的交互逻辑
    /// </summary>
    public partial class MissionProgress : Window
    {
        public MissionProgress()
        {
            InitializeComponent();
        }

        private string _MissionTitle = "场景初始化";

        public string MissionTitle
        {
            get { return _MissionTitle; }
            set { _MissionTitle = value; }
        }

        #region 进度条数值更改事件，执行窗口关闭事件
        private void Progress_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if ((sender as ProgressBar).Value == 100)
            {
                this.Close();
            }
        }
        #endregion

        #region 窗口关闭事件，确定当任务执行到100时自动关闭窗口
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //进度条的Value达到100时自动关闭窗口
            if (Progress.Value == 100)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
        #endregion
    }
}
